"use server";
import { getQuestionVoByIdUsingGet } from "@/api/questionController";
import QuesionCard from "@/components/QuestionCard";
import { Content } from "antd/es/layout/layout";
import "./index.css";

interface Params {
  questionId: string;
}
/**
 * 题库题目详情页面
 * @returns 题库题目详情页面
 */
const QuestionDetailPage: React.FC<{ params: Params }> = async ({ params }) => {
  const { questionId } = await params;

  // 获取题库题目详情
  let bankQuestionDetail: API.QuestionVO = {};

  try {
    const res = await getQuestionVoByIdUsingGet({
      id: Number(questionId),
    });
    bankQuestionDetail = res.data as API.QuestionVO;
  } catch (e: any) {
    // messageApi.error("获取题目列表失败" + e.message);
  }

  return (
    <div id="question-detail-page" className="max-width-content">
      <Content>
        <QuesionCard question={bankQuestionDetail}></QuesionCard>
      </Content>
    </div>
  );
};
export default QuestionDetailPage;
